package cn.bearspark.tag.provider.rpc;

import cn.bearspark.common.dto.Page;
import cn.bearspark.tag.dto.TagDTO;
import cn.bearspark.tag.provider.service.TagService;
import cn.bearspark.tag.rpc.TagRpc;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author f
 */
@Component
@DubboService
public class TagRpcImpl implements TagRpc {

    private final TagService tagService;

    public TagRpcImpl(TagService tagService) {
        this.tagService = tagService;
    }

    @Override
    public Page<TagDTO> pageQuery(String keyword, int pageNum, int pageSize) {
        return tagService.pageQuery(keyword, pageNum, pageSize);
    }

    @Override
    public List<TagDTO> getTop9RecentTag() {
        return tagService.getTop9RecentTag();
    }

    @Override
    public Map<Long, String> getContentMap(List<Long> tagIdList) {
        return tagService.getContentMap(tagIdList);
    }

    @Override
    public String getContent(long tagId) {
        return tagService.getContent(tagId);
    }

    @Override
    public void incrViewNum(long tagId) {
        tagService.incrViewNum(tagId);
    }

    @Override
    public void incrDiscussNum(long tagId) {
        tagService.incrDiscussNum(tagId);
    }
}
